package com.example.exception;

import lombok.Getter;

@Getter
public enum SystemErrorType implements ErrorType {

    SYSTEM_ERROR("-1", "系统异常"),
    SYSTEM_BUSY("000001", "系统繁忙,请稍候再试"),
    ARITHMETIC("000002","算数异常"),
    BIZ("123456","自定义异常"),

    GATEWAY_NOT_FOUND_SERVICE("010404", "服务未找到"),
    GATEWAY_ERROR("010500", "网关异常"),
    GATEWAY_CONNECT_TIME_OUT("010002", "网关超时"),

    ARGUMENT_NOT_VALID("020000", "请求参数校验不通过"),
    INVALID_TOKEN("020001", "无效token"),
    UPLOAD_FILE_SIZE_LIMIT("020010", "上传文件大小超过限制"),

    DUPLICATE_PRIMARY_KEY("030000", "唯一键冲突"),
    DATA_NOT_EXIST("040000", "数据不存在"),
    DATA_EXIST("040001", "数据已存在"),
    CHILD_NODE_EXIST("040002", "该节点已存在子节点,不允许新增特征"),

    //sentinel异常
    FLOW("050001", "接口限流了"),
    DEGRADE("050002", "服务降级了"),
    PARAMFLOW("050003", "热点参数限流了"),
    SYSTEMBLOCK("050004", "触发系统保护规则"),
    AUTHORITY("050005", "授权规则不通过");

    /**
     * 错误类型码
     */
    private String code;
    /**
     * 错误类型描述信息
     */
    private String msg;

    SystemErrorType(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
